{include file="header.html"}
<style>
.search > input{ width: 160px;}
.fot{ text-align: center;background: none;}
.limit{ max-width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.btn-xs{ padding-top:3px; padding-bottom:3px; border-width:0; }
.page-content .row .table{ min-width:auto; }
</style>

<div class="page-header">
	<h6>
		汇总管理
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			汇总列表
		</small>
		<div>
			<a href="javascript:void(0)" mark="remark1" class="dialog">批量改备注1</a>
			<a href="javascript:void(0)" mark="remark2" class="dialog">批量改备注2</a>
			<a href="javascript:void(0)" mark="status" class="dialog">批量改状态</a>
			<a href="javascript:void(0)" mark="import" class="dialog" skip="check">导入汇总表</a>
			<a href="javascript:void(0)" mark="export" class="dialog" skip="check">导出汇总表</a>
			<a href="?app=collect&act=edit">新增订单</a>
		</div>
	</h6>
</div>

<form class="form-inline" action="?" method="get">
<input type="hidden" name="app" value="collect" />
<input type="hidden" name="act" value="index" />
<input type="hidden" name="export" id="export" value="" />

<input type="text" name="id" placeholder="ID" value="{$id}" size="10" />
<select name="city_id" id="city_id">
<option value="">城市</option>
{foreach from=$city item=g}
<option value="{$g->city_id}" {if $city_id==$g->city_id}selected{/if}>{$g->city_name}</option>
{/foreach}
</select>

<select id="member_type" name="member_type">
<option value="">付款渠道</option>
<option value="本站" {if $member_type=='本站'}selected{/if}>本站</option>
<option value="淘宝欢创总店" {if $member_type=='淘宝欢创总店'}selected{/if}>淘宝欢创总店</option>
<option value="天猫总店" {if $member_type=='天猫总店'}selected{/if}>天猫总店</option>
<option value="淘宝广州社保代缴店" {if $member_type=='淘宝广州社保代缴店'}selected{/if}>淘宝广州社保代缴店</option>
<option value="转到公账" {if $member_type=='转到公账'}selected{/if}>转到公账</option>
</select>

<input type="text" name="member_name" placeholder="账号" value="{$member_name}" />
<input type="text" name="real_name" placeholder="姓名" value="{$real_name}" />
<input type="text" name="idcard" placeholder="身份证" value="{$idcard}" />
<input type="text" name="social_number" placeholder="社保号" value="{$social_number}" />
<input type="text" name="gjj_number" placeholder="公积金账号" value="{$gjj_number}" />
<input type="text" name="person_type" placeholder="户口性质" value="{$person_type}" />
<input type="text" name="mobile" placeholder="联系电话" value="{$mobile}" />
<input type="text" name="month" placeholder="社保缴费月份" value="{$month}" size="20" />
<input type="text" name="gmonth" placeholder="公积金缴费月份" value="{$gmonth}" size="20" />
<input type="text" name="remark1" placeholder="备注1" value="{$remark1}" size="20" />
<input type="text" name="remark2" placeholder="备注2" value="{$remark2}" size="20" />
<select name="status" id="status">
<option value="">社保增员状态</option>
{foreach from=$status_list key=k item=g}
<option value="{$k}" {if strval($status)==strval($k)}selected{/if}>{$g}</option>
{/foreach}
</select>
<select name="kstatus" id="kstatus">
<option value="">社保扣费状态</option>
{foreach from=$kstatus_list key=k item=g}
<option value="{$k}" {if strval($kstatus)==strval($k)}selected{/if}>{$g}</option>
{/foreach}
</select>
<select name="gstatus" id="gstatus">
<option value="">公积金增员状态</option>
{foreach from=$gstatus_list key=k item=g}
<option value="{$k}" {if strval($gstatus)==strval($k)}selected{/if}>{$g}</option>
{/foreach}
</select>
<select name="gkstatus" id="gkstatus">
<option value="">公积金扣费状态</option>
{foreach from=$gkstatus_list key=k item=g}
<option value="{$k}" {if strval($gkstatus)==strval($k)}selected{/if}>{$g}</option>
{/foreach}
</select>
<input type="text" name="pagesize" placeholder="页码大小" value="{if $pagesize==50}{else}{$pagesize}{/if}" />
<button type="submit" class="btn btn-info btn-sm">
	<i class="ace-icon fa fa-search bigger-110"></i>搜索
</button>
</form>

<div class="form-inline column">
	<div>显示列：</div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',1,')===false}checked{/if} /><span class="lbl">城市</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',2,')===false}checked{/if} /><span class="lbl">付款渠道</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',3,')===false}checked{/if} /><span class="lbl">账号</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',4,')===false}checked{/if} /><span class="lbl">首次缴费</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',5,')===false}checked{/if} /><span class="lbl">姓名</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',6,')===false}checked{/if} /><span class="lbl">身份证</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',7,')===false}checked{/if} /><span class="lbl">社保号</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',8,')===false}checked{/if} /><span class="lbl">公积金账号</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',9,')===false}checked{/if} /><span class="lbl">户口性质</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',10,')===false}checked{/if} /><span class="lbl">联系电话</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',11,')===false}checked{/if} /><span class="lbl">社保档次</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',12,')===false}checked{/if} /><span class="lbl">社保费用</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',13,')===false}checked{/if} /><span class="lbl">公积金费用</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',14,')===false}checked{/if} /><span class="lbl">社保服务费</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',15,')===false}checked{/if} /><span class="lbl">公积金服务费</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',16,')===false}checked{/if} /><span class="lbl">合计剩余费用</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',17,')===false}checked{/if} /><span class="lbl">社保缴费月份</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',18,')===false}checked{/if} /><span class="lbl">公积金缴费月份</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',19,')===false}checked{/if} /><span class="lbl">备注1</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',20,')===false}checked{/if} /><span class="lbl">备注2</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',21,')===false}checked{/if} /><span class="lbl">社保增员状态</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',22,')===false}checked{/if} /><span class="lbl">社保扣费状态</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',23,')===false}checked{/if} /><span class="lbl">公积金增员状态</span></label></div>
	<div class="checkbox"><label><input type="checkbox" class="ace" {if strpos(','|cat:$admin->hidden_columns|cat:',', ',24,')===false}checked{/if} /><span class="lbl">公积金扣费状态</span></label></div>
</div>

<form action="?app=collect&act=check_cate" method="post" id="tochange" enctype="multipart/form-data">
<input type="hidden" name="cate_type" id="cate_type" />
<input type="hidden" name="city_id" value="{$city_id}" />
<input type="hidden" name="member_type" value="{$member_type}" />
<input type="hidden" name="member_name" value="{$member_name}" />
<input type="hidden" name="real_name" value="{$real_name}" />
<input type="hidden" name="idcard" value="{$idcard}" />
<input type="hidden" name="social_number" value="{$social_number}" />
<input type="hidden" name="gjj_number" value="{$gjj_number}" />
<input type="hidden" name="person_type" value="{$person_type}" />
<input type="hidden" name="mobile" value="{$mobile}" />
<input type="hidden" name="month" value="{$month}" />
<input type="hidden" name="gmonth" value="{$gmonth}" />
<input type="hidden" name="remark1" value="{$remark1}" />
<input type="hidden" name="remark2" value="{$remark2}" />
<input type="hidden" name="status" value="{$status}" />
<input type="hidden" name="kstatus" value="{$kstatus}" />
<input type="hidden" name="gstatus" value="{$gstatus}" />
<input type="hidden" name="gkstatus" value="{$gkstatus}" />
<div class="table-content">
<table id="simple-table" class="table table-striped table-bordered table-hover">
	<thead>
		<tr>
			<!--<th><input type="checkbox" class="checkboxes" title="全选" /></th>-->
			<th>ID</th>
			<th>城市</th>
			<th>付款渠道</th>
			<th>账号</th>
			<th>首次缴费</th>
			<th>姓名</th>
			<th>身份证</th>
			<th>社保号</th>
			<th>公积金账号</th>
			<th>户口性质</th>
			<th>联系电话</th>
			<th>社保档次</th>
			<th>社保<br />费用</th>
			<th>公积金<br />费用</th>
			<th>社保<br />服务费</th>
			<th>公积金<br />服务费</th>
			<th>合计剩余费用</th>
			<th>社保<br />缴费月份</th>
			<th>公积金<br />缴费月份</th>
			<th>备注1</th>
			<th>备注2</th>
			<th>社保<br />增员状态</th>
			<th>社保<br />扣费状态</th>
			<th>公积金<br />增员状态</th>
			<th>公积金<br />扣费状态</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		{foreach from=$rs item=row}
		<tr>
			<td>{$row->id}</td>
			<td>{$row->city_name}</td>
			<td>{$row->member_type}</td>
			<td><div class="limit" title="{$row->member_name}">{$row->member_name}</div></td>
			<td>{if $row->begin_date>0}{$row->begin_date}{else}-{/if}</td>
			<td>{$row->real_name}</td>
			<td>{$row->idcard}</td>
			<td>{$row->social_number}</td>
			<td>{$row->gjj_number}</td>
			<td>{$row->person_type}</td>
			<td>{$row->mobile}</td>
			<td>{$row->casy_name}</td>
			<td>{$row->social_price}</td>
			<td>{$row->gjj_price}</td>
			<td>{$row->service_price}</td>
			<td>{$row->gjj_service_price}</td>
			<td>{$row->total_price}</td>
			<td><div class="limit" title="{$row->month}">{$row->month}</div></td>
			<td><div class="limit" title="{$row->gmonth}">{$row->gmonth}</div></td>
			<td><div class="limit" title="{$row->remark1}">{$row->remark1}</div></td>
			<td><div class="limit" title="{$row->remark2}">{$row->remark2}</div></td>
			<td>{$row->status}</td>
			<td>{$row->kstatus}</td>
			<td>{$row->gstatus}</td>
			<td>{$row->gkstatus}</td>
			<td style="padding:5px;">
				<a href="?app=collect&act=edit&id={$row->id}">
					<button type="button" class="btn btn-xs btn-info">
					<i class="ace-icon fa fa-pencil bigger-120"></i>
				</button>
				</a>
				<a href="?app=collect&act=delete&id={$row->id}" class="delete">
					<button type="button" class="btn btn-xs btn-danger">
					<i class="ace-icon fa fa-trash-o bigger-120"></i>
				</button>
				</a>
			</td>
		</tr>
		{foreachelse}
		<tr bgcolor="white"><td colspan="24" height="50">暂无记录</td></tr>
		{/foreach}
	</tbody>
</table>
</div>

<!-- 弹出 -->
<div class="modal fade" id="to-remark1" role="dialog" aria-labelledby="gridSystemModalLabel">
	<div class="modal-dialog row" role="document" style="margin-top:8%;">
		<div class="modal-content col-lg-8 col-lg-offset-2">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			</div>
			<div class="modal-body">
				<div class="container-fluid">
					请填写备注1<br />
					<textarea name="modal_remark1" style="width:100%;"></textarea>
				</div>
			</div>
			<div class="modal-footer fot">
				<button type="button" class="btn" data-dismiss="modal"> 取消 </button>
				<button type="button" class="btn get-to"> 提交 </button>
			</div>
		</div>
	</div>
</div>

<div class="modal fade" id="to-remark2" role="dialog" aria-labelledby="gridSystemModalLabel">
	<div class="modal-dialog row" role="document" style="margin-top:8%;">
		<div class="modal-content col-lg-8 col-lg-offset-2">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			</div>
			<div class="modal-body">
				<div class="container-fluid">
					请填写备注2<br />
					<textarea name="modal_remark2" style="width:100%;"></textarea>
				</div>
			</div>
			<div class="modal-footer fot">
				<button type="button" class="btn" data-dismiss="modal"> 取消 </button>
				<button type="button" class="btn get-to"> 提交 </button>
			</div>
		</div>
	</div>
</div>

<div class="modal fade" id="to-status" role="dialog" aria-labelledby="gridSystemModalLabel">
	<div class="modal-dialog row" role="document" style="margin-top:8%;">
		<div class="modal-content col-lg-8 col-lg-offset-2">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			</div>
			<div class="modal-body">
				<div class="container-fluid">
					请选择状态<br />
					<select name="modal_status" style="width:150px;">
					<option value="">社保增员状态</option>
					{foreach from=$status_list key=k item=g}
					<option value="{$k}" {if strval($status)==strval($k)}selected{/if}>{$g}</option>
					{/foreach}
					</select>
					<select name="modal_kstatus" style="width:150px;">
					<option value="">社保扣费状态</option>
					{foreach from=$kstatus_list key=k item=g}
					<option value="{$k}" {if strval($kstatus)==strval($k)}selected{/if}>{$g}</option>
					{/foreach}
					</select>
					<select name="modal_gstatus" style="width:150px;">
					<option value="">公积金增员状态</option>
					{foreach from=$gstatus_list key=k item=g}
					<option value="{$k}" {if strval($gstatus)==strval($k)}selected{/if}>{$g}</option>
					{/foreach}
					</select>
					<select name="modal_gkstatus" style="width:150px;">
					<option value="">公积金扣费状态</option>
					{foreach from=$gkstatus_list key=k item=g}
					<option value="{$k}" {if strval($gkstatus)==strval($k)}selected{/if}>{$g}</option>
					{/foreach}
					</select>
				</div>
			</div>
			<div class="modal-footer fot">
				<button type="button" class="btn" data-dismiss="modal"> 取消 </button>
				<button type="button" class="btn get-to"> 提交 </button>
			</div>
		</div>
	</div>
</div>

<div class="modal fade" id="to-import" role="dialog" aria-labelledby="gridSystemModalLabel">
	<div class="modal-dialog row" role="document" style="margin-top:8%;">
		<div class="modal-content col-lg-8 col-lg-offset-2">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			</div>
			<div class="modal-body">
				<div class="container-fluid">
					选择Excel表：<input type="file" name="file" id="file" style="display:inline-block;width:200px;" />
				</div>
			</div>
			<div class="modal-footer fot">
				<button type="button" class="btn" data-dismiss="modal"> 取消 </button>
				<button type="button" class="btn get-to import"> 提交 </button>
			</div>
		</div>
	</div>
</div>
</form>

<div class="mypage">
	共 {$page.num_records} 个记录  {$page.current_page} / {$page.num_pages} 页  {$page.first_page} {$page.prev} {$page.nav} {$page.next} {$page.last_page}
</div>
{include file="footer.html"}
<script>
function changeColumn(){
	var index = $(this).parents('.checkbox').eq(0).index();
	if(this.checked){
		$('.table thead tr th').eq(index).removeClass('hidden');
		$('.table tbody tr').each(function(){
			$(this).find('td').eq(index).removeClass('hidden');
		});
	}else{
		$('.table thead tr th').eq(index).addClass('hidden');
		$('.table tbody tr').each(function(){
			$(this).find('td').eq(index).addClass('hidden');
		});
	}
}
$(function(){
	$('.limit').tips();
	$('.table .checkboxes').change(function(){
		$('.table .checkbox:checkbox').checked(this.checked);
	});
	$('.table tr').dblclick(function(){
		self.location='?app=collect&act=edit&id='+($(this).find("td:first").text());
	});
	$('.column :checkbox').each(function(){
		changeColumn.call(this);
	}).change(function(){
		changeColumn.call(this);
		var ids = [];
		$('.column :checkbox:not(:checked)').each(function(){
			var index = $(this).parents('.checkbox').eq(0).index();
			ids.push(index);
		});
		$.postJSON('api.php?app=collect&act=save_column', { ids:ids.join(',') });
	});
	$('.page-header .dialog').click(function(){
		//if(!!!$(this).attr('skip') && !$('.checkbox:checked').length){ alert('请选择需要修改的记录');return }
		var mark = $(this).attr('mark');
		if(mark=='export'){
			if(confirm('确定导出吗？')){
				$('#export').val(1);
				$('form.form-inline').submit();
				setTimeout(function(){ $('#export').val('') }, 10);
			}
			return;
		}
		$('#cate_type').val(mark);
		$('#to-'+mark).modal();
	});
	$('.get-to').click(function(){
		var model = $(this).parents('.modal').eq(0), id = model.attr('id');
		switch(id){
			case 'to-remark1':
				//if(!model.find('#remark1').val().length){ alert('请填写备注内容');return }
				break;
			case 'to-remark2':
				//if(!model.find('#remark2').val().length){ alert('请填写备注内容');return }
				break;
			case 'to-status':
				//if(!model.find('#status').selected().val().length){ alert('请选择状态');return }
				break;
			case 'to-import':
				if(!model.find('#file').val().length){ alert('请选择需要导入的Excel文件');return }
				break;
		}
		$('#tochange').submit();
	});
});
</script>
